/*
 * Created on 11.04.2008
 * @author Jens Anuth
*/
package albareth.tests;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JFrame;

public class WalkDirTest extends JFrame
{
    Color color1 = new Color(30, 0, 30);
    Color color2 = new Color(50, 0, 50);
    Color color3 = new Color(70, 0, 70);
    Color color4 = new Color(90, 0, 90);
    Color color5 = new Color(110, 0, 110);
    Color color6 = new Color(130, 0, 130);
    Color color7 = new Color(150, 0, 150);
    Color color8 = new Color(170, 0, 170);

    /**
     * @param args
     */
    public static void main(String[] args)
    {
        WalkDirTest test = new WalkDirTest();
        test.setSize(500,500);
        test.show();

    }

    public void paint(Graphics g)
    {
        super.paint(g);

        int px = 200, py = 200;
        for (int tx = 0; tx < 400; tx++)
        {
            for (int ty = 0; ty < 400; ty++)
            {
                int dx = tx - px;
                int dy = ty - py;
                int dxAbs = Math.abs(dx);
                int dyAbs = Math.abs(dy);
                
                if (dy < 0 && dyAbs >= 2*dxAbs) {
                    g.setColor(color1);
                } else if (dx < 0 && dy < 0 && dyAbs < 2*dxAbs  && dxAbs < 2*dyAbs ) {
                    g.setColor(color2);
                } else if (dx < 0           && dxAbs >= 2*dyAbs ) {
                    g.setColor(color3);
                } else if (dx < 0 && dy >= 0 && dyAbs < 2*dxAbs  && dxAbs < 2*dyAbs ) {
                    g.setColor(color4);
                } else if (          dy >= 0 && dyAbs >= 2*dxAbs) {
                    g.setColor(color5);
                    
                } else if (dx >= 0 && dy >= 0 && dyAbs < 2*dxAbs  && dxAbs < 2*dyAbs ) {
                    g.setColor(color6);
                } else if (dx >= 0            && dxAbs >= 2*dyAbs ) {
                    g.setColor(color7);
                } else if (dx >= 0 && dy < 0 && dyAbs < 2*dxAbs  && dxAbs < 2*dyAbs ) {
                    g.setColor(color8);

                } else {
                    g.setColor(Color.WHITE);
                }
                
                g.drawRect(tx, ty, 1, 1);
            }
        }
    }

}
